<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>魏远商城商品详情</title>
		<link rel="stylesheet" type="text/css" href="../../css/common/public.css" />
		<link rel="stylesheet" type="text/css" href="../../css/goods/detalis.css" />
		<script src="../../js/pase.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../../css/common/pase.css"/>
		<style type="text/css">
			.box{
				position: relative;
				width: 454px;
				height: 87px;
				overflow: hidden;
			}
			.box>span{
				display: inline-block;
				float: left;
			}
			#top-m-img{
				width: 391px;
				height: 87px;
			}
			#next,#prev{
				background-color: white;
				display: inline-block;
				width: 29px;
				height: 87px;
				line-height: 104px;
			}
			#next{
				top: 0;
				left: 0;
				z-index: 10;
   				position: absolute;
				text-align: left;
			}
			#prev{
				top: 0;
				right: 0;
				z-index: 10;
   				position: absolute;
				margin-left: 8px;
				text-align: right;
			}
			/*详情*/
			#details1 {
				font-size: 12px;
				color: #545353;
				margin: auto;
				padding: 30px;
				width: 750px;
			}
			
			#details1:after {
				content: "";
				display: block;
				clear: both;
				height: 0;
			}
			
			#details1 div {
				margin-bottom: 18px;
				float: left;
				width: 33.3333333%;
			}
			
			.add-de span {
				display: inline-block;
			}
			
			#details-mo {
				font-size: 12px;
				width: 750px;
				margin: auto;
				display: block;
				text-align: right;
				color: #EAAF27;
				padding-bottom: 7px;
				border-bottom: 1px solid #ddd;
			}
			#details-mo span{
				
				display: none;
			}
			.mo-zjpl{
				    display: block;
    float: left;
    width: 86px;
    height: 86px;
    border: 2px solid #EEEEEE;
    padding: 5px;
    margin-right: 16px;
			}
			/*.top-m-l{
				background-color: gainsboro;
			}*/
		</style>
	</head>

	<body>
		<div id="abc">
			
			<!--头部-->
			<div class="top_all">
				<div class="top">
					<div class="top_con">
						<div class="tlogin"></div>
						<div class="gotoregister" style="display: none;">免费注册</div>
						<div class="homepage">商城首页</div>
						<div class="tmyorder">我的订单<img src="../../image/turn_down.png"></div>						
						<div class="home_car" id="home_car"><img src="../../image/shop_car.png">购物车<span class="car_time">0</span><img src="../../image/turn_down.png"></div>
						<div class="line_ke">联系客服<img src="../../image/turn_down.png"></div>							
					</div>		
				</div>
				<div class="loged" style="display: none;">
					<div><span class="guanli">账号管理</span>|<span class="out">退出</span></div>
					<div class="thead">
						<div class="thead_pic"><span></span></div>
						<div class="tmenber">企业会员</div>
					</div>
				</div>
				<div class="myorder">
					<span class="order_1">待支付</span>
					<span class="order_2">待发货</span>
					<span class="order_3">待收货</span>
					<span class="order_4">待评价</span>
				</div>
				<div class="tcont">
					<span class="mine1">用户帮助</span>
					<span class="mine2">联系客服</span>
					<span class="mine3">投诉建议</span>
					<span class="mine4">退换货</span>
					<span class="mine5">收货地址管理</span>
				</div>
				
				<div class="logeandsear">
					<div class="imageLogo"><img src="../../image/Logo.png"></div>
					<div class="search">
						<div>
							<img class="search-icon" src="../../image/search-icon.png"><input type="text" class="home_searchto" placeholder="魏远产品搜索" /><span class="gotosearch">搜索</span><span class="searchtips">X请输入您要搜索的内容</span>
						</div>
					</div>
			    </div>
			</div>	
			<div class="right">
					<div class="right_car"><span><img src="../../image/righr_car.png"></br>购</br>物</br>车</span></div>
				<div class="youhuiquan"><span>优</br>惠</br>券</span></div>
				<div class="qianbao"><span>钱</br>包</span></div>
				<div class="qiyeshangc"><span>企</br>业</br>商</br>城</span></div>
				<div class="totop"><span><br/>^<br/>TOP</span></div>
			</div>
			<div class="wrap">
			</div>
			<!--内容头-->
			<div class="select">
				<div>
					<span class="alltype">全部商品分类</span>
					<span  class="home_hot">热销爆款</span>
					<span class="home_new">新品速递</span>
					<span class="home_acv">营销活动</span>
					<span class="home_topg">优品馆</span>
					<!--李勇-->
					<div class="downtypeg" style="display: none;">
						<div class="downtypegdivall">
							<div class="downtypegdiv"></div>						
							<div class="downcatediv" style="display: none;"></div>						
						</div>
				    </div>
					<!--李勇结束-->
					<!--<div class="downtypeg">
					</div>-->
				</div>
				<!--<div><span class="alltype">全部商品分类</span><span>热销爆款</span><span>新品速递</span><span>营销活动</span><span>优品馆</span>
				</div>-->
			</div>
			<!--内容-->
			<div class="top1">
				<div class="top-t"><span class="huancun1">首页</span><span class="top-t-h">></span><span class="huancun"></span><span class="top-t-f">></span><span class="top-t-text2"></span></div>
				<div class="top-m">
					<!--详情-->
					<div class="top-m-l">
						<span id="top-m-img1" style="background-image: url();"></span>
						<div class="box">
							<span id="next"><img src="../../image/left.png"/></span>
							<span id="top-m-img" style="width: 391px;margin-left: 27px;">
								<!--<span class="topImg" style="background-image: url(../../image/head-dog.png);"></span>
								<span class="topImg" style="background-image: url(../../image/nogood.png)"></span>
								<span class="topImg" style="background-image: url(../../image/logol.png) "></span>
								<span class="topImg" style="background-image: url(../../image/bottom.png);"></span>-->
								<!--<span class="topImg" style="background-image: url(../../image/cart.png)"></span>-->
								<!--<span class="topImg" style="background-image: url(../../image/helper_banner.png) "></span>-->
							</span>
							<span id="prev"><img src="../../image/right.png"/></span>
						</div>
						
					</div>
					<div class="top-m-r">
						<div id="topDetails"></div>
						<div class="top-m-r-f">
							<div id="topName1"></div>
							<div id="topName2"></div>
						</div>
						<div class="top-m-r-s">
							<span>售价</span>
							<span id="topPrice1"></span>
							<span><del id="topPrice2"></del></span>
							<span class="times-de">
								<span class="activity"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hms"></span><span class="hmf"></span><span class="hmm"></span>
							</span>

						</div>
						<!--组合商品-->
						<div class="clickProduce" id="product">
							<div class="comProduct">组合商品：</div>
							<!--<div class="product">-->
								<!--<div><span>小米笔记本</span><span>(100.00元)</span></div>-->
								<!--<div class="de-style">
									 <div class="top-m-r-t">
										<span>颜色</span>
										<span class="top-c">
											<span id="11">红色</span>
											<span id="44">白色</span>
											<span>灰色</span>
											<span>蓝色</span>
											<span>绿色</span>
											<span>橙色</span>
										</span>
									</div>
									<div class="top-m-r-t">
										<span>尺寸</span>
										<span class="top-c">
											<span id="22">S码</span>
											<span id="33">M码</span>
											<span>L码</span>
											<span >XL码</span>
											<span>XXL码</span>
											<span>XXXL码</span>
										</span>
									</div>
								</div>-->
							<!--</div>-->
							
							<!--<div class="product">
								<div><span>金刚侠</span><span>(50.00元)</span></div>
								<div class="de-style">
									 <div class="top-m-r-t">
										<span>颜色</span>
										<span class="top-c">
											<span>此商品为固定属性</span>
										</span>
									</div>
								</div>
							</div>-->
							<!--<div class="product">
								<div><span>土豆</span><span>(10.00元)</span></div>
								<div class="de-style">
								</div>
							</div>-->
						</div>
						<!--非组合商品-->
						<div id="noProduce" class="clickProduce de-style">
							<!--<div class="top-m-r-t">
								<span>颜色</span>
								<span class="top-c">
									<span>红色</span>
									<span>白色</span>
									<span>灰色</span>
									<span>蓝色</span>
									<span>绿色</span>
									<span>橙色</span>
								</span>
							</div>
							<div class="top-m-r-t">
								<span>尺寸</span>
								<span class="top-c">
									<span>S码</span>
									<span>M码</span>
									<span>L码</span>
									<span>XL码</span>
									<span>XXL码</span>
									<span>XXXL码</span>
								</span>
							</div>-->
						</div>
						<div class="top-m-r-t2">
								该商品为固定销售属性，直接确定购买哒
						</div>
						<div class="top-m-r-fo">
							<span>数量</span>
							<span>
							<!--<form>
								<input class="car-input1 top-but" type=button value="-">
								<input class="car-input2 top-m-input" type=text name=amount value='+data.result.data[i].number+'>
								<input class="car-input3 top-but1" type=button value="+">
							</form>-->
							<form>
								<input class="top-but" type=button value="-" onClick="javascript:this.form.amount.value--;">
								<input type=text class="car-input2 top-m-input" name=amount value=1>
								<input  type=button class="car-input3" value="+">
							</form>
							</span>
							<span class="text-ts">* 您所填写的商品数量超过库存！</span>
						</div>
						<div class="top-m-r-fi">
							<span id="de-cart">加入购物车</span>
						</div>
					</div>
				</div>
			</div>
			<!--详情-->
			<div class="main">
				<div class="main-t">
					<div></div>
					<div id="c-chang1">
						<span class="main-act1">商品介绍</span>
						<span class="main-act2">商品评价</span>
					</div>
					<div></div>
				</div>
				<div id="c-chang2">
					<!--商品详情-->
					<div class="de-de">
						<div id="details1">
							<!--<div class="add-de">
								<span><span>系列</span><span>：</span></span>
								<span>蓝海洋系列</span>
							</div>
							<div class="add-de">
								<span><span>原料</span><span>：</span></span>
								<span>原生木浆</span>
							</div>
							<div class="add-de">
								<span><span>纸张尺寸</span><span>：</span></span>
								<span>卫生标准</span>
							</div>
							<div class="add-de">
								<span><span>适合肤质</span><span>：</span></span>
								<span>油性皮肤</span>
							</div>
							<div class="add-de">
								<span><span>系列</span><span>：</span></span>
								<span>蓝海洋系列</span>
							</div>
							<div class="add-de">
								<span><span>原料</span><span>：</span></span>
								<span>原生木浆</span>
							</div>
							<div class="add-de">
								<span><span>纸张尺寸</span><span>：</span></span>
								<span>卫生标准</span>
							</div>
							<div class="add-de">
								<span><span>适合肤质</span><span>：</span></span>
								<span>油性皮肤</span>
							</div>-->
					</div>
					<div id="details-mo">
						<span>更多参数 ></span>
					</div>
						<div id="details" class="main-xq">
						<!--详情-->
					   </div>
					</div>
						
					<!--商品评价-->
					<div class="main-pj">
						<!--编写评价-->
						<div class="evaluate">
							<div class="evaluate-t">快让其他买家看到您的评价吧！</div>
							<div class="evaluate-m">
								<div class="evaluate-m1"><span>评价：</span><span><textarea placeholder="亲，您的五星好评是我们无限的动力~~" name="" rows="" cols=""></textarea></span></div>
								<div class="evaluate-m2">
									<span class="picture1">我要晒图</span>
									<input type="file" id="inputs" multiple="multiple" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" name=""  value="" />
									<span class="picture" id="picture">
										<!--<span class="picture-img" style="background-image: url(../../image/beijing.png);"><span class="shangchu"><span class="shangchu1"><img src="../../image/delect.png"/></span></span></span>
										<span class="picture-img" style="background-image: url(../../img/cart-yp.png);"><span class="shangchu"><span class="shangchu1"><img src="../../image/delect.png"/></span></span></span>
										<span class="picture-img" style="background-image: url(../../image/pay-success.png);"><span class="shangchu"><span class="shangchu1"><img src="../../image/delect.png"/></span></span></span>-->
									</span>
									<span class="niming"><span><img src="../../image/cart-select1.png"/></span>匿名评价</span>
								</div>
							</div>
							<div class="evaluate-start">
								<div class="evaluate-start1">
									<span class="evaluate-l">描述相符：</span>
									<span id="descrip" class="evaluate-r">
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
									</span>
								</div>
								<div class="evaluate-start1">
									<span class="evaluate-l">物流服务：</span>
									<span id="logistics" class="evaluate-r">
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
									</span>
								</div>
								<div class="evaluate-start1">
									<span class="evaluate-l">服务态度：</span>
									<span id="serve" class="evaluate-r">
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
										<img class="img" src="../../image/evaluate1.png"/>
									</span>
								</div>
							</div>
							<div class="evaluate-f"><span>提交评价</span></div>
						</div>
						<!--获取评价-->
						<div id="main-pj-t" class="main-pj-t">
							<span class="main-span"><span><img class="main-img" src="../../image/selsect1.png"/></span><span>全部评价（<span id="mainNum">0</span>）</span></span>
							<span class="main-span"><span><img class="main-img" src="../../image/selsect2.png"/></span><span>晒图（<span id="mainNum1">0</span>）</span></span>
						</div>
						<!--非空-->
						<div id="shaiTu">
							<div class="main-pj-m">
								<!--<div id="hqImg">
									<div class="main-pj-m1">
										<span style="background-image: url(../../image/head-dog.png);"></span>
										<span>Anguler</span>
									</div>
									<div class="main-evaluate">
										<div class="main-pj-m2">
											<div>很好使用，真的是不错</div>
											<div id="hqImg1">
													<span style="background-image: url(../../img/1.jpg);background-position: center;background-repeat: no-repeat;background-size: contain;"></span>
											</div>
											<div>
												<span>型号：1号</span>
												<span>尺寸：55</span>
												<span>2017年4月10日 6：57</span>
											</div>
										</div>
										<div class="zjeEvaluate">
											<div class="evaluatetitle">我是追加评论追追追追追追追追追追追追追</div>
											<div id="hqImg2">
												<span><img src="../../img/2.jpg"/></span>
												<span><img src="../../img/1.jpg"/></span>
												<span><img src="../../img/2.jpg"/></span>
											</div>
											<div class="evaluateTime">2017年12月</div>
										</div>
										<div class="server">
											<div><span>[客服回复]</span><span>谢谢亲</span></div>
											<div class="evaluateTime">2017年12月</div>
										</div>
									</div>
								</div>-->
							</div><!--全部评价-->
							<!--有晒图的-->
							<div style="display: none;" class="main-pj-st">
								
							</div><!--晒图的评价结束-->
						</div>
						<!--页数-->
						<div style="margin-top: 50px;"> 
							<div id="page"></div>
							<!--多页-->
							<!--<div class="main-pj-f main-pj-f-d">
								<span>上一页</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>...</span><span>下一页</span>
							</div>-->
							<!--单页-->
							<!--<div class="main-pj-f main-pj-f-s">
							<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span>
							</div>-->
						</div>
						<!--空-->
						<div id="pjKong">
							<div class="main-pj-k">此商品暂无评价</div>
						</div>
					</div>
				</div>
			</div>
			
			<div style="margin-bottom: 50px;"></div>
			<!--底部代码-->
		    <div style="padding-top: 50px;">
				<div class="wrap_bottom"><img src="../../image/bottom.png"></div>
			</div>
		</div>
		<!--弹框-->
		<div class="pop1"></div>
		<div class="pop">
			<div class="pop-t">提示 <img class="pop-img" src="../../image/creat_cancel.png"/></div>
			<div>
				<div class="pop-text">抱歉！您还未登录！</div>
				<div class="pop-y">确认</div>
			</div>
		</div>
	</body>
	<script src="../../assets/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/url.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../assets/jquery.fly.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/super_slider.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/scrollPic.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		
		$('.downtypeg').css('height','700px');
		
		$(function(){
//			alert(localStorage.wyshopwheretypeb);
    	     if(localStorage.wyshopwheretypeb == 66) {
//					$('.hot_titles').text('营销活动');
					$('.home_hot').css('color','#FFC100');
				} else if(localStorage.wyshopwheretypeb == 65) {
					$('.home_new').css('color','#FFC100');
				} else if(localStorage.wyshopwheretypeb == 59) {
					$('.home_acv').css('color','#FFC100');
				} else if(localStorage.wyshopwheretypeb == 64) {
					$('.home_topg').css('color','#FFC100');
				}else if(localStorage.wyshopwheretypeb == 0) {
					$('.alltype').css('color','#FFC100');
				}
         })
		
		
		
	$(function(){
		window.onbeforeunload = function() {
			var unloads = document.getElementById("abc").value; 
			if(unloads == null || unloads == ""){ 
			localStorage.wyshopifevalute='';
			localStorage.wyshopifevalute=null;
			} 
		}
//		alert(localStorage.wyshopwheredetails+'库存id')
//		localStorage.wyshopwheredetails = 274;
//		localStorage.wyshopifevalute = 1
		showdetails();
		if(localStorage.wyshopifevalute == 1){
			$('.evaluate').css('display','block');
			$('.main-pj').css('display','block');
			$('#details').css('display','none');
			$('.de-de').css('display','none');
			$('#c-chang1>span:last-child').attr('class', 'main-act1');
			$('#c-chang1>span:first-child').attr('class', 'main-act2');
			$('.main-pj-st').html('');
				pace();
		}
		else if(localStorage.wyshopifevalute == 0){
			$('.evaluate').css('display','block');
			$('.main-pj').css('display','block');
			$('#details').css('display','none');
			$('.de-de').css('display','none');
			$('#c-chang1>span:last-child').attr('class', 'main-act1');
			$('#c-chang1>span:first-child').attr('class', 'main-act2');
			$('.evaluate-start').css('display','none');
			$('.main-pj-st').html('');
				pace();
		}
		else{
			$('.evaluate').css('display','none')
		}
		
		/*弹框*/
		var left = ((document.body.clientWidth) - 435)/2;
		function pop(){
			$('.pop').css('left',left)
			$('.pop1').css('display','block');
			$('.pop').css('display','block');
		};
		function pop1(){
			$('.pop1').css('display','none');
			$('.pop').css('display','none');
		};
		$('.pop-img').click(function(){
			pop1();
		});
		$('.pop-y').click(function(){
			pop1();
		});
		/*弹框结束*/
		
		 $('.alltype, .downtypeg').on('mouseover',function(){
		 	  if(localStorage.wyshopwheretypeb==0){
		 	  	 $('.alltype').css('color','#333333');
		 	  }
	             $('.downtypeg').css('display','block');
	             $('.alltype').css('background-color','#ffc100');
//	             fenleishow();
//	             alert(11);
	       })     

        $('.alltype, .downtypeg').on('mouseout',function(){
        	if(localStorage.wyshopwheretypeb==0){
		 	  	 $('.alltype').css('color','#FFC100');
		 	}
       	      $('.downtypeg').css('display','none');
       	      $('.alltype').css('background-color','transparent');
//     	      fenleishow();
        })
        /*李勇结束*/
//		$('.downtypeg').css('width',wid+'px');
		$('.downtypeg').css('display','none');
//		$('.alltype').css('background-color','white');
//      alert(localStorage.wyshopwhatclass1);
        /*alert(localStorage.wyshopwhatclass);*/
        if(localStorage.wyshopwhatclass1==''){
        	$('.top-t-h').css('display','none');
        }
        if(localStorage.wyshopwhatclass==''){
        	$('.top-t-f').css('display','none');
        
        }
		$('.huancun1').text(localStorage.wyshopwhatclass1);
		$('.huancun').text(localStorage.wyshopwhatclass);
		var endDate = "";
		var staDate = "";
		sessionStorage.wyShopActivity = "";
//		sessionStorage.ifcanbug = "";
		
		//加入购物车
			$('#de-cart').click(function(event){
//				console.log(JSON.stringify(event))
				var addCar = $(this);
				if($('.de-style div').length==0){
					$('.top-m-r-t2').css('display','block');
					if(sessionStorage.wyShopActivity == 0) {
						$('.pop-text').text('活动已结束，不能加入购物车');
						pop();
					} else if(sessionStorage.wyShopActivity == 1) {
						$('.pop-text').text('活动未开始，不能加入购物车');
						pop();
					} else if(sessionStorage.wyShopActivity == 2) {
						addcar(event);//提交订单
					}else{
						addcar(event);
					}
				}else{
					if($('.de-style').find('.de-act').html()==undefined){
							$('.pop-text').text('请选择商品属性');
							pop();
						}else{
							var n1 = $('.de-style div').length;
							var n2 = $('.de-style .de-act').length;
							if(n1==n2){
								addcar(event);//提交订单
							}else{
								$('.pop-text').text('商品属性未选择完整');
								pop();
							}
						}
					}
						//提交订单接口
				function addcar(event) {
					if(localStorage.wyShopProduce == 'wyShopProduce'){//组合商品
						var skuArrs = "";
						//检查数据====start
						for(var key in zhd) {
							if(zhd[key] == 0) {
								skuArrs = "";
								break;
							}
							skuArrs += zhd[key] + ":";
						}
						var dataCart1 =skuArrs.substring(0, skuArrs.lastIndexOf(":"));
						var dataCart={
								"shoppingcartVO.comSkuIds": dataCart1,
								"shoppingcartVO.number": $('.car-input2').val(),//数量
								"shoppingcartVO.productSkuId": localStorage.addcarId,
							}
					}
					if(localStorage.wyShopProduce == 'wyShopNoProduce'){//非组合商品
						if(enterp==''){
							var dataCart={
									"shoppingcartVO.number": $('.car-input2').val(),//数量
									"shoppingcartVO.productSkuId": localStorage.addcarId
									
							}
						}else if(enterp!=''){
							var dataCart={
									"shoppingcartVO.number": $('.car-input2').val(),//数量
									"shoppingcartVO.productSkuId": localStorage.addcarId,//商品库存ID
									"shoppingcartVO.enterProductId":enterp//企业商品编号
							}
						}
						console.log(JSON.stringify(enterp)+'提交订单的信息')
					}
					
					$.ajax({
						url: ur + '/mobilemember/shoppingcart/addcart',
						type: 'post',
						dataType: 'json',
						headers: {
							"X-Token": localStorage.wyshoptoken
						},
						data: dataCart,
						success: function(data) {
		//					console.log(data);
							if(data.result.meta.code == 200) {
								add(event);
		//						window.location.href="../cart/cart.html";
							} else if(data.result.meta.code == 201) {
								$('.pop-text').text('请先登录');
								pop();
							} else if(data.result.meta.code == 303) {
								$('.pop-text').text('登录过期，请重新登录');
								pop();
							}else if(data.result.meta.code == 202){
								$('.pop-text').text('库存不足！请稍等');
								pop();
							}
						}
					})
				}
				function add(event){
						var offset = $("#home_car").offset();
						var addcar1 =addCar.parents('.top-m').find('#top-m-img1').attr('style'); 
						var a = addcar1.indexOf('(')+2;
						var b = addcar1.indexOf('")');
						var pUrl = addcar1.substring(a,b);
						var flyer = $('<img  class="u-flyer" src="'+pUrl+'">');
						var scroll = document.body.scrollTop;
//						alert(scroll+'高度')
						flyer.fly({
									start: {
										left: event.clientX,
										top: event.clientY  -70,
//										left: event.pageX,
//										top: event.pageY - scroll-70,
									},
									end: {
										left: offset.left,
										top: offset.top,
										width: 0,
										height: 0
									},
									onEnd:function(){
//										更新购物车数量
										this.destory();
										if($('.car_time').text() == ''){
											$('.car_time').text('1');
										}else{
											$('.car_time').text(parseFloat($('.car_time').text())+ 1);
										}
										
									}
								});
								
				}//结束
			})

		//				输入	
		carInput();//封装透明
		function carInput(){
			if($('.car-input2').val()==1){
				$('.top-but').css('opacity', '0.5')
			}else{
				$('.top-but').css('opacity', '1')
			}
		}
		//加减透明
		$('.car-input2').keyup(function() {
			var amount3 = /^[0-9]*[1-9][0-9]*$/;
			if(!amount3.test($(this).val())) {
				$(this).val('1');
				$('.top-but').css('opacity', '0.5');
			}
			carInput();
			var kucun = $('.text-ts').text();
				var inp = $(this).val();
				if(parseFloat(inp)> parseFloat(kucun)){
					$(this).val(kucun);
					$('.car-input3').css('opacity','0.5');
				}else{
					$('.car-input3').css('opacity','1');
				}
		})
		$('.car-input3').click(function() {
			$(this.form.amount.value++);
			var kucun = $('.text-ts').text();
			var numCun = $('.car-input2').val();
			if( parseFloat(numCun)> parseFloat(kucun)){
				$('.car-input2').val(kucun);
				$('.car-input3').css('opacity','0.5');
			}else{
				$('.top-but').css('opacity', '1')
			}
			
		})
		//		数量
		$('.top-but').click(function() {
			if(this.form.amount.value <= 1) {
				this.form.amount.value = 1;
			} 
			var kucun = $('.text-ts').text();
			var numCun = $('.car-input2').val();
		if( parseFloat(numCun)< parseFloat(kucun)){
				$('.car-input3').css('opacity','1');
			}else{
				$('.top-but').css('opacity', '0.5')
			}
			carInput();
		})
		//		获取评价
		$('#c-chang1>span').on('click', function() {
			$(this).attr('class', 'main-act1');
			$(this).siblings().attr('class', 'main-act2');
			$('#c-chang2>div').eq($(this).index()).css('display', 'block');
			$('#c-chang2>div').eq($(this).index()).siblings().css('display', 'none');
			if($(this).index()==1){
				 numPhoto = '';
				$('.main-pj-st').html('');
				pace();
//				discuss();//商品评价
			}
		})
		//		晒图
		$('#main-pj-t>span').on('click', function() {
			$(this).find('.main-img').attr('src', '../../image/selsect1.png');
			$(this).siblings().find('.main-img').attr('src', '../../image/selsect2.png');
			$('#shaiTu>div').eq($(this).index()).css('display','block');
			$('#shaiTu>div').eq($(this).index()).siblings().css('display','none');
//			alert($(this).index());
			if($(this).index()==1){
				$('#page').css('display','none')
			}else{
				$('#page').css('display','block')
			}
		})
		//		款式
		function dj(){
		$('.clickProduce').on('click','.top-c>span',function(){
			$(this).css('background-color', '#FFC100');
			$(this).addClass('de-act');
			$(this).siblings().removeClass('de-act');
			$(this).siblings().css('background-color', '#EEEEEE');
			//更新价格
			var styleNum = $(this).parents('.product').index();
				var n1 = $(this).parents('.de-style').find('.top-m-r-t').length;//属性的个数
				var n2 = $(this).parents('.de-style').find('.de-act').length;
				if(n1==n2){
					var attribute='';
					var attribute1='';
					var attribute3='';
					if(n1==n2){
						for(var n = 0;n < n1; n++){
							var attribute2 =$(this).parents('.de-style').find('.de-act').eq(n).attr('id');
							attribute1=attribute1 + attribute2 + ',';
						}
						if(attribute1.split(',')){
							attribute3 = attribute1.substring(0, attribute1.length - 1).split(',').sort();//对数组进行排序
							for(var j = 0;j<attribute3.length;j++){
								attribute = attribute+attribute3[j]+',';//再变字符串
							}
							attribute = attribute.substring(0, attribute1.length - 1);//去逗号
						}else{
							attribute = attribute1.substring(0, attribute1.length - 1);
						}
						if(localStorage.wyShopProduce == 'wyShopProduce'){
							localStorage.wyshopwheredetails=$(this).parents('.product').attr('wid');
							localStorage.producePrice=$(this).parents('.product').index();
							var priceId =$(this);
							newPrice();
						}
						if(localStorage.wyShopProduce == 'wyShopNoProduce'){
							newPrice()
						}
								//更新价格
						function newPrice(){
							$.ajax({
								url: ur + '/mobile/product/getPrice',
								type: 'post',
								dataType: 'json',
								headers: {
									"X-Token": localStorage.wyshoptoken
								},
								data: {
									"attribute": attribute,
									"proudutid": localStorage.wyshopwheredetails,
								},
								success: function(data) {
									console.log(JSON.stringify(data)+'更新价格')
									if(data.result.meta.code == 200) {
										if(localStorage.wyShopProduce == 'wyShopProduce'){
											$('.producePrice').eq(localStorage.producePrice-1).text('￥'+data.result.data.skuArrir.newPrice);
											zhd[priceId.parents('.product').attr('id')]=data.result.data.skuArrir.skuId;
											console.log(JSON.stringify(zhd));
										}
										if(localStorage.wyShopProduce == 'wyShopNoProduce'){
											$('#topPrice1').text('￥'+data.result.data.skuArrir.newPrice);
											localStorage.addcarId = data.result.data.skuArrir.skuId;
										}
									}
								}
							})
						}
						console.log(attribute);
					}
				}	
		})
		}//封装点击结束
		var enterp = '';
		//			小图片
		$('#top-m-img').on('mouseover','span',function(){
			$(this).css('border','1px solid #ffc100');
			$(this).siblings().css('border','1px solid #eee');
			var a = $(this).attr('style').indexOf('(')+2;
			var b = $(this).attr('style').indexOf('")');
			var pUrl =  $(this).attr('style').substring(a,b);
//			console.log(pUrl);
			$('#top-m-img1').attr('style','background-image: url('+pUrl+')');
		})
		//      	更多参数anguler开始
		$('#details-mo').click(function() {
			moreDe();
			function moreDe() {
				$.ajax({
					url: ur + '/mobile/product/detail',
					type: 'post',
					dataType: 'json',
					headers: {
						"X-Token": localStorage.wyshoptoken
					},
					data: {
						"id": parseInt(localStorage.wyshopwheredetails),
					},
					success: function(data) {
						if(data.result.meta.code == 200) {
							$('#details-mo').unbind('click');
							if(!data.result.data.comProductExtVOs) { /*非组合商品*/
								console.log(JSON.stringify(data.result.data.propVOs))
								console.log(data.result.data.propVOs.length)
                                 
								var xiangLe = data.result.data.propVOs.length;
								for(var xl = 12; xl < xiangLe; xl++) {
									var divXiang = $('<div class="add-de">' +
										'<span><span>' + data.result.data.propVOs[xl].proName + '</span><span>：</span></span>' +
										'<span>' + data.result.data.propVOs[xl].proValue + '</span>' + '</div>');
									$('#details1').append(divXiang);
								}
								$('#details-mo').text('已无更多').css('color','#777')
							} else {
								
							}
						}
					}
				})
			}

		})
//      	更多参数anguler结束
		//			接口对接
		//		商品详情
		var zhd = {};
		function showdetails() {
			$.ajax({
				url: ur + '/mobile/product/detail',
				type: 'post',
				dataType: 'json',
				headers: {
					"X-Token": localStorage.wyshoptoken
				},
				data: {
					"id": parseInt(localStorage.wyshopwheredetails),
				},
				success: function(data) {
//					console.log(data.result.data.comProductExtVOs + '>>>商品详情')
					var code = data.result.meta.code;
					if(code == 200) {
						$('.top-t-text2').text(data.result.data.shortName);
						//营销活动开始
						if(data.result.data.marketingEndTimeString != null) {
							$('.times-de').css('display', 'inline-block');
						}else{
							sessionStorage.wyShopActivity = 3;
						}
						//营销活动结束
						if(data.result.data.comProductExtVOs){
							$('.comProduct').css('display','block')
							localStorage.wyShopProduce = 'wyShopProduce';
							localStorage.addcarId = data.result.data.skuid;
							localStorage.addcarId1= data.result.data.skuid;
							var imgl = data.result.data.imgsrc;//图片
							var imgls = imgl.split(',');
							$('#top-m-img1').css('background-image', 'url(' + picur + imgls[0] + ')');//大图片
							for(var i = 0; i < imgls.length+1; i++) {//小图片
								var div = $('<span class="topImg" style="background-image: url('+picur + imgls[i]+');"></span>');
									$('#top-m-img').append(div);
								}
							$('#topName1').text(data.result.data.description);
							$('#topName2').text(data.result.data.longName);
//							$('#topPrice1').text('￥'+ data.result.data.newPrice.toFixed(2));
//							$('#topPrice2').text('￥'+ data.result.data.price.toFixed(2));
							
							if(data.result.data.newPrice!=data.result.data.price){                    	
//                          	$('.disprice').css('display','block');
                                var pricenew = data.result.data.newPrice;
                                $('#topPrice1').text('￥'+ Math.round(pricenew * 100) / 100);
                                $('#topPrice2').text('￥'+ data.result.data.price.toFixed(2));
                            	                           	
                            }else if(data.result.data.newPrice==data.result.data.price){
                            	$('#topPrice2').css('display','none');
                            	$('#topPrice1').text('￥'+ Math.round(pricenew * 100) / 100);
                            }
							
							
							$('.text-ts').text(data.result.data.enableNum);
							var zdgoods = data.result.data.comProductExtVOs.length;
							
							for(var z = 0; z < zdgoods; z++) {
								console.log(data.result.data.comProductExtVOs.length+'//组合商品');//组合商品
								var proDiv = $('<div class="product" id="' + z + '" wid="' + data.result.data.comProductExtVOs[z].id + '">' +
									'<div><span>'+data.result.data.comProductExtVOs[z].shortName+'</span><span class="producePrice">('+data.result.data.comProductExtVOs[z].price+'元)</span></div>'+
									'<div class="de-style de-style'+z+'">'+
//										 '<div class="top-m-r-t">'+
//											'<span>颜色</span>'+
//											'<span class="top-c">'+
//												'<span>红色</span>'+
//											'</span>'+
//										'</div>'+
									'</div>	'+
								'</div>	');
								$('#product').append(proDiv);
								zhd[z]=0;
								if(data.result.data.comProductExtVOs[z].proMap.length > 0) {
									console.log(data.result.data.comProductExtVOs[z].proMap.length+'属性长度')
									for(var x = 0; x < data.result.data.comProductExtVOs[z].proMap.length; x++) {
										var proDiv1 = $('<div class="top-m-r-t">'+
													'<span>'+data.result.data.comProductExtVOs[z].proMap[x].arrit+'</span>'+
													'<span class="top-c" id="top-c'+z+x+'">'+
														//样式叠加
													'</span>'+'</div>');
										$('.de-style'+z).append(proDiv1);
										console.log(data.result.data.comProductExtVOs[z].proMap[x].value.length+'属性个数')
										for(var c = 0; c < data.result.data.comProductExtVOs[z].proMap[x].value.length; c++) {
											var proDiv2 = $('<span id="' + data.result.data.comProductExtVOs[z].proMap[x].value[c].id + '">' + data.result.data.comProductExtVOs[z].proMap[x].value[c].value + '</span>');
											$('#top-c' +z+ x).append(proDiv2);
										}
									}
								} else if(data.result.data.comProductExtVOs[z].proMap.length == 0) {
									zhd[z]=data.result.data.comProductExtVOs[z].skuid;
									$('.de-style'+z).append('<span class="abc">此商品为固定属性</span>');
								}
							}
							
							
						}else{
							endDate = data.result.data.marketingEndTimeString;
							staDate = data.result.data.marketingStartTimeString;
							localStorage.wyShopProduce = 'wyShopNoProduce';
							noProduct();
						}
						dj();
						
						function noProduct(){//非组合商品
							localStorage.addcarId = data.result.data.skuid;
							localStorage.addcarId1 = data.result.data.skuid;
							if(data.result.data.enterpriseProId){
								enterp = data.result.data.enterpriseProId;
							}
							//						商品介绍
							$('#details').append(data.result.data.detail);
							
							/*Anguler开始*/
								console.log(JSON.stringify(data.result.data.propVOs))
								console.log(data.result.data.propVOs.length)
								var xiangLe = data.result.data.propVOs.length;
									if(xiangLe > 12) {
										for(var xl = 0; xl < 12; xl++) {
											var divXiang = $('<div class="add-de">' +
												'<span><span>' + data.result.data.propVOs[xl].proName + '</span><span>：</span></span>' +
												'<span>' + data.result.data.propVOs[xl].proValue + '</span>' + '</div>');
											$('#details1').append(divXiang);
										}
										$('#details-mo span').css('display','block')
										$('.add-fo').css('display', 'block')
									} else {
										for(var xl = 0; xl < xiangLe; xl++) {
											var divXiang = $('<div class="add-de">' +
												'<span><span>' + data.result.data.propVOs[xl].proName + '</span><span>：</span></span>' +
												'<span>' + data.result.data.propVOs[xl].proValue + '</span>' + '</div>');
											$('#details1').append(divXiang);
										}
										$('#details-mo span').css('display','none')
									}
							/*Anguler结束*/
							$('.content').css('width', '100%');
							var imgs = $('#details img');
							for(var n = 0; n < imgs.length; n++) {
								var dimg = $(imgs[n]).attr('src');
								if(dimg.indexOf('http')<0){
                                  	$(imgs[n]).attr('src', picur + dimg);
                                  }
							}
							$('#details img').css({'width':'100%','display':'block'});
							//						商品介绍
							//商品详情
							var imgl = data.result.data.imgsrc;//图片
							var imgls = imgl.split(',');
							$('#top-m-img1').css('background-image', 'url(' + picur + imgls[0] + ')');//大图片
							for(var i = 0; i < imgls.length+1; i++) {//小图片
								var div = $('<span class="topImg" style="background-image: url('+picur + imgls[i]+');"></span>');
									$('#top-m-img').append(div);
								}
							$('#topName1').text(data.result.data.shortName);
							$('#topName2').text(data.result.data.longName);
							
							
							if(data.result.data.newPrice!=data.result.data.price){                	
//                          	$('.disprice').css('display','block');
                                var pricenew = data.result.data.newPrice;
                                $('#topPrice1').text('￥'+ Math.round(pricenew * 100) / 100);
                                $('#topPrice2').text('￥'+ data.result.data.price.toFixed(2));
                            	                           	
                            }else if(data.result.data.newPrice==data.result.data.price){
                            	var pricenew = data.result.data.newPrice;
                            	$('#topPrice2').css('display','none');
                            	$('#topPrice1').text('￥'+ Math.round(pricenew * 100) / 100);
                            }
							
							
							$('.text-ts').text(data.result.data.enableNum);
							var numStyle = data.result.data.proMap.length;
							if(numStyle == 0) {
								//该商品为固定销售属性，直接确定购买哒
								$('.top-m-r-t2').css('display','block');
								$('.de-style').css('display','none');
								} else {
									for(var i = 0; i < numStyle; i++) {
										var div1 = $('<div class="top-m-r-t">'+
													'<span>'+data.result.data.proMap[i].arrit+'</span>'+
													'<span class="top-c" id="'+i+'">'+
														//样式叠加
													'</span>'+'</div>');
										$('#noProduce').append(div1)
										for(var y = 0; y < data.result.data.proMap[i].value.length; y++) {
											var div2 = $('<span id="' + data.result.data.proMap[i].value[y].id + '">' + data.result.data.proMap[i].value[y].value + '</span>');
											$('#' + i + '').append(div2);
										}
									}
								}
							$('.top-m').append(div);
							//商品详情结束
						}
						slider();
					}
				},
				error: function(data) {
					console.log(JSON.stringify(data)+'错误')
				}
			})
			
		};
		//获取商品评价
//		var pageSize=1;
//		var pagenow = 1;
		var numPhoto = '';
		discuss1();
		function discuss1(){
			$.ajax({
				url: ur + '/mobilemember/comment/productcommentlist',
				type: 'post',
				dataType: 'json',
				data: {
					"id": localStorage.wyshopwheredetails,
					"numPerPage": '',//分页中每页显示多少条
					"pageNum": '',//是分页中的第几页
					"pageRequest": '1'
				},
				success: function(data) {
					if(data.status == 200) {
						sessionStorage.wyShopPase = data.content.length;
						$('#mainNum').text(sessionStorage.wyShopPase);
						var num = data.content.length;
						for(var i = 0;i<num;i++){
							if(data.content[i].photo) {
								console.log(i+'全部个数')
								numPhoto++;
							}else{
								for(var zj1 = 0;zj1 <data.content[i].appendCmt.length;zj1++){
									if(data.content[i].appendCmt[zj1].photo){
										console.log(i+'全部个数')
										numPhoto++;
										break;
									}
								}
							}
						}
//						alert(numPhoto+'全部个数')
						$('#mainNum1').text(numPhoto);//晒图数量
						if(numPhoto==0){
							$('#mainNum1').text('0');
						}else{
							$('#mainNum1').text(numPhoto);
						}
					}
				},
			})
		}

		function pace(){
			
			var p = new Page('page');
			//总记录数
			p.recordCount = sessionStorage.wyShopPase;
			//分页按扭数
			p.numericButtonCount = 6;
			//每页记录数YW
			p.pageSize = 5;
			//当点击分页时触发此事件。 一些外加的效果可以放在此处， 如加载数据
			p.addListener('pageChanged', function() {
				p.render();
				$('.main-pj-m').html('');
				discuss()
			});
			p.initialize();
		
		
		function discuss() {
			$.ajax({
				url: ur + '/mobilemember/comment/productcommentlist',
				type: 'post',
				dataType: 'json',
				data: {
					"id": localStorage.wyshopwheredetails,
					"numPerPage": p.pageSize,//分页中每页显示多少条
					"pageNum": p.pageIndex,//是分页中的第几页
					"pageRequest": '1'
				},
				success: function(data) {
					console.log(JSON.stringify(data)+'获取商品评价');
					if(data.status == 200) {
//						pagenow++;
//						pageSize++;
						var num = data.content.length;
//						$('#mainNum').text(num);//评价个数
						for(var i = 0;i<num;i++){
							var div3 =$('<div class="hqImg">'+
									'<div class="main-pj-m1">'+
										'<span style="background-image: url('+picur + data.content[i].ufHeadPhoto+');"></span>'+
										'<span>'+data.content[i].nickName+'</span>'+
									'</div>'+
									'<div class="main-evaluate">'+
									'<div class="main-pj-m2">'+
										'<div>'+data.content[i].content+'</div>'+
										'<div class="hqImg1 img'+i+'" >'+
//										图片的循环
//											'<span><img src="../../img/2.jpg"/></span>'+
										'</div>'+
										'<div>'+
											'<span>'+data.content[i].size+'</span>'+
//											'<span>尺寸：55</span>'+
											'<span>'+data.content[i].cmtTime.substr(0, 10)+'</span>'+
										'</div>'+
									'</div>'+
									//追加评价
									'<div class="zjeEvaluate zjpl'+i+'">'+//<!--//追加-->
//											'<div class="evaluatetitle">我是追加评论追追追追追追追追追追追追追</div>'+
//											'<div id="hqImg2">'+
//												'<span><img src="../../img/2.jpg"/></span>'+
//											'</div>'+
//											'<div class="evaluateTime">2017年12月</div>'+
										'<div class="server kefu'+i+'">'+//<!--客服-->
//											'<div><span>[客服回复]</span><span>谢谢亲</span></div>'+
//											'<div class="evaluateTime">2017年12月</div>'+
										'</div>'+
										'</div>'+
//										'<div class="server kefu'+i+'">'+//<!--客服-->
////											'<div><span>[客服回复]</span><span>谢谢亲</span></div>'+
////											'<div class="evaluateTime">2017年12月</div>'+
//										'</div>'+
//									'</div>'+
								'</div>');
							$('.main-pj-m').append(div3);
							//评价图片
							if(data.content[i].photo != '') {
								$('.hqImg1').css('height','100px');
								numPhoto++;
								console.log(data.content[i].photo+'图片')
								var imgd = data.content[i].photo.split(',');
								for(var g = 0 ;g<imgd.length-1;g++){
										var imgspan = $('<span style="background-image: url('+picur + imgd[g]+');"></span>');
										$('.img' + i ).append(imgspan);
									}
//								if(imgd.length>4){
//									for(var g = 0 ;g<3;g++){
//										var imgspan = $('<span style="background-image: url('+picur + imgd[g]+');"></span>');
//										$('.img' + i ).append(imgspan);
//									}
//								}else{
//									for(var g = 0 ;g<imgd.length-1;g++){
//										var imgspan = $('<span style="background-image: url('+picur + imgd[g]+');"></span>');
//										$('.img' + i ).append(imgspan);
//									}
//								}
								
							}//放入图片是与否和数量 结束
							//客服回复
							if(data.content[i].replyContent == '' || data.content[i].replyContent == null) {
								$('.kefu'+i).css('display','none')
							}else{
								
								
//								alert('有客户回复')
								$('.kefu'+i).css('margin-top','23px');
								var kefuDiv=$('<div><span>[客服回复]</span><span>'+data.content[i].replyContent+'</span></div>');
//											'<div class="evaluateTime">'+data.content[i].replyTime+'</div>');
								$('.kefu'+i).append(kefuDiv);
							}//客服回复结束
							
							
							//追加评价
							if(data.content[i].appendCmt.length > 0) {
//								alert(data.content[2].appendCmt.length+'长度')
								for(var zj1 = 0;zj1 <data.content[i].appendCmt.length;zj1++){
									
									var zjPj=$('<div class="evaluatetitle">'+data.content[i].appendCmt[zj1].content+'</div>'+
											'<div class="hqImg2 zj'+i+zj1+'">'+
//												'<span><img src="../../img/2.jpg"/></span>'+
											'</div>'+
											'<div class="evaluateTime">'+data.content[i].appendCmt[zj1].cmtTime.substring(0, 10)+'</div>'+
											'<div class="server zjkefu'+i+zj1+'">'+//<!--客服-->
//											'<div><span>[客服回复]</span><span>谢谢亲</span></div>'+
//											'<div class="evaluateTime">2017年12月</div>'+
											'</div>'
											);
									$('.zjpl'+i).append(zjPj);//所有的评论
									
									if(data.content[i].appendCmt[zj1].photo != ''){
										var zjImg = data.content[i].appendCmt[zj1].photo.split(',');
										for(var z = 0 ;z<zjImg.length-1;z++){
												var zjImg1 = $('<span class="mo-zjpl" style="background-image: url('+picur + zjImg[z]+');"></span>');
												$('.zj'+i+zj1).append(zjImg1);
											}
									}
									if(data.content[i].appendCmt[zj1].replyContent == '' || data.content[i].appendCmt[zj1].replyContent == null){
										
									}else{
										$('.zjkefu'+i+zj1).css('margin-top','23px');
										var kefuDiv=$('<div><span>[客服回复]</span><span>'+data.content[i].appendCmt[zj1].replyContent+'</span></div>');
//													'<div class="evaluateTime">'+data.content[i].appendCmt[zj1].replyTime+'</div>');
										$('.zjkefu'+i+zj1).append(kefuDiv);
									}
									
								}
								
								
								
								
//								var zjPj=$('<div class="evaluatetitle">'+data.content[i].appendCmt[0].content+'</div>'+
//											'<div id="hqImg2" class="zj'+i+'">'+
////												'<span><img src="../../img/2.jpg"/></span>'+
//											'</div>'+
//											'<div class="evaluateTime">'+data.content[i].appendCmt[0].cmtTime.substring(0, 10)+'</div>');
//								$('.zjpl'+i).append(zjPj);
								/*if(data.content[i].appendCmt[0].photo != ''){
									var zjImg = data.content[i].appendCmt[0].photo.split(',');
									console.log(zjImg)
									for(var z = 0 ;z<zjImg.length-1;z++){
											var zjImg1 = $('<span style="background-image: url('+picur + zjImg[z]+');"></span>');
											$('.zj'+i).append(zjImg1);
										}
//									if(zjImg.length>4){
//										alert('第一步')
//										for(var z = 0 ;z<3;z++){
//											var zjImg1 = $('<span style="background-image: url('+picur + zjImg[z]+');"></span>');
//											$('.zj'+i).append(zjImg1);
//										}
//									}else{
//										alert('第二步')
//										for(var z = 0 ;z<imgd.length-1;z++){
//											var zjImg1 = $('<span style="background-image: url('+picur + zjImg[z]+');"></span>');
//											$('.zj'+i).append(zjImg1);
//										}
//									}
								}*/
											
							}
							//评价结束
							/*晒图*/		
							if(data.content[i].photo != '') {
								$('main-pj-st').html('');
								$('.main-pj-st').append('<div class="hqImg">'+$('.main-pj-m>div').eq(i).html()+'</div>')
							}
						}
//						$('#mainNum1').text(numPhoto);//晒图数量
//						if(numPhoto==0){
//							$('#mainNum1').text('0');
//						}else{
//							$('#mainNum1').text(numPhoto);
//						}
						
					} else if(data.status == 201) {
						$('#pjKong').css('display','block');
						$('#page').css('display','none')
					}
				},
				error: function(data) {
				}
			})
		}
		}//分页
		//提交商品评价
		//匿名评价
			var niming=true;
			$('.niming span').click(function(){
				if(niming){
					$('.niming img').attr('src','../../image/cart-select2.png');
				    niming = false;
				}else{
					$('.niming img').attr('src','../../image/cart-select1.png');
				    niming = true;
				}
			})
			//提交评价
			$('.evaluate-f>span').click(function(){
				var n = $(this).parents('.evaluate').find('.picture-img').length;
				if(!n){
					phone ='';
				}else{
					var a='';
					var b='';
					var picarr1 = [];
					var pUrl='';
					for(var m = 0;m<n;m++){
						
						a = $('.picture-img').eq(m).attr('style').indexOf('(')+1;
						b = $('.picture-img').eq(m).attr('style').indexOf(')');
						pUrl = $('.picture-img').eq(m).attr('style').substring(a,b).replace('data:image/jpeg;base64,','');
						
//						alert(pUrl)
//						pUrl =  $('.picture-img'+m).attr('style').substring(a,b);
//						alert(pUrl+'《》《》图片《》《》')
						 picarr1.push(pUrl);
					}
//					alert(picarr1.length)
//					console.log('332' + picarr1[0]);
//					console.log('333' + picarr1[1]);
//					console.log('334' + picarr1[2]);
//					console.log('308' + picarr1.join());
				}
				
				if($('textarea').val()==''){
					$('.pop-text').text('您还没评价哦');
					pop();
				}else{
						$('textarea').val();
						$('#descrip').find('.img').length;
						$('#logistics').find('.img').length;
						$('#serve').find('.img').length;
						//评价图片
						var phone = picarr1.join();
						
							pingjia(phone);
						}
							//		提交评价接口
							function pingjia(phone){
								if(niming==true){
									isDelete=2;
								}else{
									isDelete=3;
								}
								$.ajax({
									url: ur + '/mobilemember/comment/comment',
									type: 'POST',
									headers: {
										"X-Token": localStorage.wyshoptoken
									},
									dataType: 'json',
									data: {
										"commentVO.content": $('textarea').val(),//评论的内容
										"commentVO.deliverSpeed": $('#logistics').find('.img').length,//	评论的物流速度
										"commentVO.descSimilar": $('#descrip').find('.img').length,//评论的相似符合度
										"commentVO.isDelete": isDelete,//是否匿名，2是 3否
										"commentVO.serviceAttitude": $('#serve').find('.img').length,//服务态度
										"commentVO.skuId": localStorage.wyshopspskuid,//库存商品ID
										"fileName": '.png',//文件名
//										"orderVO.id":'1040',
										"orderVO.id": localStorage.wyshopsureorderid,//	订单的id
										"photo": phone//图片的base64编码，多张图片以,隔开
									},
									success: function(data) {
										if(data.result.meta.code==200){
										$('.pop-text').text('评论成功');
										pop();
										localStorage.wyshopifevalute = '';
										$('.evaluate').css('display','none');
										$('.de-de').css('display','none');
										discuss1();
										$('.main-pj-st').html('');
										pace();
										}else if(data.result.meta.code==201){
											$('.pop-text').text('系统错误，请稍后再试');
											pop();
//											alert('系统错误');
										}else if(data.result.meta.code==202){
											$('.pop-text').text('系统错误，请稍后再试');
											pop();
										}
									},
									error: function(data) {
										console.log(JSON.stringify(data));
									}
								})
							}
					
			});
		//隐藏我要晒图
		function shaitu(){
			if($('#picture>span').length==3){
				$('.picture1').css('display','none');
				$('input[type="file"]').css('display','none');
			}else{
				$('.picture1').css('display','block');
				$('input[type="file"]').css('display','block');
			}
		}
		//发表评价图片
//		var picarr = [];
		$("#inputs").change(function() {
				var fil = this.files;
				for(var i = 0; i < fil.length; i++) {
					reads(fil[i]);
					function reads(fil){
						var reader = new FileReader();
						reader.readAsDataURL(fil);
						reader.onload = function() {
//							alert(1);
//                           console.log(reader.result);
//                          var pUrlreal = reader.result.substr(reader.result.indexOf(',')+1, reader.result.length);
//                          picarr.push(pUrlreal);
							document.getElementById("picture").innerHTML += '<span class="picture-img" style="background-image: url('+reader.result+');"><span class="shangchu"><span class="shangchu1"><img src="../../image/delect.png"/></span></span></span>';
//							document.getElementById("picture").innerHTML += '<span class="picture-img" style="background-image: url(../../image/beijing.png);"><span class="shangchu"><span class="shangchu1"><img src="../../image/delect.png"/></span></span></span>';
						}; 
						
//						console.log(picarr);
//						console.log('332' + picarr[0]);
//						console.log('333' + picarr[1]);
//						console.log('334' + picarr[2]);
//						console.log('308' + picarr.join());

					}
				}
			if($('#picture>span').length==2){
				$('.picture1').css('display','none');
				$('input[type="file"]').css('display','none');
			}else{
				$('.picture1').css('display','block');
				$('input[type="file"]').css('display','block');
			}
		});
		//删除图片
			var shangchu =true;
			$('#picture').on('click','.picture-img',function(){
				if(shangchu){
					$(this).find('.shangchu').css('display','block');
					shangchu=false;
				}else{
					$(this).find('.shangchu').css('display','none');
					shangchu=true;
				}
			});
			$('#picture').on('click','.shangchu1',function(){
				$(this).parent().parent().remove();
//				$('.picture')
//              alert($('.picture').children($(this).parents('.picture-img')).index());
				$(this).parents('.picture-img').index();
				shangchu=true;
				shaitu();//晒图显示与隐藏
				
			});
		//星星切换
			$('.evaluate-r img').click(function(){
				var startNum=$(this).index()+1;
				$(this).attr('src','../../image/evaluate1.png');
				$(this).siblings().attr('src','../../image/evaluate1.png');
				$(this).nextAll().attr('src','../../image/evaluate2.png');
				$(this).addClass('img');
				$(this).siblings().addClass('img');
				$(this).nextAll().removeClass('img');
			});
		//压缩图片
			function uploadHead(imgPath) {
				//			生成比例
				var image = new Image();
				image.style.width = "100px";
				image.style.height = "100px";
				image.src = imgPath; //传过来的图片的路径
				image.onload = function() {
					//压缩图片
					var imgData = getBase64Image(image);
//					console.log(imgData+'路径base64');
				}
			}
			//	压缩图片
			function getBase64Image(img) {
				var canvas = document.createElement("canvas"); //找到canvas元素
				var width = img.width;
				var height = img.height;
				canvas.width = width;
				canvas.height = height;
				var ctx = canvas.getContext('2d'); //创建canvas对象 
				ctx.drawImage(img, 0, 0, width, height); //绘图
				var dataURL = canvas.toDataURL("image/jpeg", 0.5);
				return dataURL;
			}
			//营销活动
			/*营销活动倒计时*/
			setInterval(function(){
				dateTime1();
			},1000)
			function dateTime1(){
				var nowDate = new Date();
				var endDate2 = new Date(endDate);
				var staDate2 = new Date(staDate);
				if(endDate ==''||endDate==null||staDate==''||staDate==null){
					$('.times-de').css('display', 'none');
				}else{
					$('.times-de').css('display', 'inline-block');
						if(nowDate > endDate2){
							$('.activity').text('活动已结束');
							sessionStorage.wyShopActivity = 0;
							$('#de-cart').css('background-color','#ccc')
						}else if(nowDate < staDate2){
							$('.activity').text('距活动开始     ');
							$('#de-cart').css('background-color','#ccc')
							var time = staDate2 - nowDate;
							sessionStorage.wyShopActivity = 1;
							time2();
						}else if(endDate2 > nowDate && nowDate > staDate2){
							$('.activity').text('距活动结束');
							$('#de-cart').text('立即抢购');
							sessionStorage.wyShopActivity = 2;
							var time = endDate2 - nowDate;
							time2();
						}
						function time2(){
							var nH = Math.floor(new Date(time) / (1000 * 60 * 60));
							var nM = Math.floor(new Date(time) / (1000 * 60)) % 60;
							var nS = Math.floor(new Date(time) / 1000) % 60;
						    $('.hms').text(nH+'个时:');
							$('.hmf').text(nM+'分:');
							$('.hmm').text(nS+'秒');
						}
						
				}
			}
		function slider(){
			$(".box").superSlider({
				prevBtn: 	 "#prev",//左按钮
				nextBtn: 	 "#next",//右按钮
				listCont:    "#top-m-img",//滚动列表外层
	//			scrollWhere: "prev",//自动滚动方向next
				delayTime: 	 1000,//自动轮播时间间隔
				speed: 		 300,//滚动速度
				amount: 	 1,//单次滚动数量
				showNum: 	 4,//显示数量
				autoPlay: 	  false //自动播放
			});
		}	
	})
	</script>

</html>